package com.forenow.demo.demo24;

import java.io.*;

public class Bufferedemo {
    public static void main(String[] args) {
        try {
            //创建一个节点流
            FileReader reader = new FileReader("IOdemo.java");
            //创建一个BufferedReader处理流
            BufferedReader br=new BufferedReader(reader);
            FileWriter fw=new FileWriter("IOdemo_new.java");
            BufferedWriter bw=new BufferedWriter(fw);
            //读取源文件中的一行
            String line = br.readLine();
            while (line!=null){
                bw.write(line);
                bw.newLine();
                //读取下一行
                line=br.readLine();
            }
            //关闭资源
            br.close();
            bw.close();
            reader.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
